package com.codeoss.framework.util;

import java.math.BigDecimal;
import java.util.Date;

import org.springframework.stereotype.Component;

@Component
public class TimeUtil {
	public BigDecimal diffHours(Date startDate,Date endDate) {
		if(startDate==null ||endDate==null) {
			return null;
		}
		Long starTime=startDate.getTime();
        Long endTime=endDate.getTime();
        Long num=endTime-starTime;
        BigDecimal value=new BigDecimal(num).divide(new BigDecimal(3600000),2,BigDecimal.ROUND_HALF_UP);
        return value;
	}
}
